package com.tedu.controller;

import com.tedu.entity.User;
import com.tedu.mapper.UserMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;

import javax.annotation.Resource;
import java.util.List;

/**
 * Author：程Sir
 * Name： SpringTest01
 * Content:
 */
@Controller
public class UserController {
//    @Resource
    @Autowired
    private UserMapper userMapper;

    public void selectOne(Integer id){
        User u = userMapper.findUserById(id);

        System.out.println("获取的数据是："+u);
    }

    public void selectAll(){
        List<User> u = userMapper.findUsers("t_user");
        System.out.println("获取的数据是："+u);
    }

    public void addUser(User user){
        int row = userMapper.insertUser(user);
        System.out.println("影响的行数是："+row);
    }


}
